package com.indiv.pmy.shape;

import java.awt.Color;
import java.awt.Graphics;

public class Circle extends Shape {
	Point center;
	double radius;
	
	public Circle() {
		center = new Point(0.0, 0.0);
		radius = 10;
	}
	
	public Circle(double _x, double _y, double _radius) {
		center = new Point(_x, _y);
		radius = _radius;
	}
	
	public double getX() { return center.getX(); }
	public double getY() { return center.getY(); }
	public Point getCenter() { return center; }
	public double getRadius() { return radius; }
	
	public void setX(double _x) { center.setX(_x); }
	public void setY(double _y) { center.setY(_y); }
	public void setCenter(Point _center) { center = _center; }
	public void setRadius(double _radius) { radius = _radius; }

	@Override
	public void draw(Graphics _g) {
		Color old = _g.getColor();
		_g.setColor(Color.black);
		_g.drawOval((int)(center.getX()-radius), (int)(center.getY()-radius), (int)(radius*2), (int)(radius*2));
		_g.setColor(old);
	}

	@Override
	public void destroy() {
		center = null;
		radius = 0.0;
	}
	
	@Override
	public void rotate(double[][] _rotationMatrix) {
		//Since this is a circle we don't need to handle any rotations
	}

	@Override
	public void translate(double[] _translationMatrix) {
		center.setX(center.getX()+_translationMatrix[0]);
		center.setY(center.getY()+_translationMatrix[1]);
	}

	@Override
	public void scale(double[] _scaleMatrix) {
		radius = radius * _scaleMatrix[0];
	}
}
